<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Java二维数组完全指南</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        
        .card-hover {
            transition: all 0.3s ease;
        }
        
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0,0,0,0.1);
        }
        
        .code-block {
            background: #1e1e1e;
            color: #d4d4d4;
            border-radius: 12px;
            overflow: hidden;
            position: relative;
        }
        
        .code-block::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 40px;
            background: #2d2d2d;
            border-bottom: 1px solid #3e3e3e;
        }
        
        .code-block pre {
            padding: 60px 24px 24px;
            margin: 0;
            overflow-x: auto;
        }
        
        .section-title {
            position: relative;
            display: inline-block;
        }
        
        .section-title::after {
            content: '';
            position: absolute;
            bottom: -8px;
            left: 0;
            width: 60px;
            height: 4px;
            background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
            border-radius: 2px;
        }
        
        .feature-icon {
            width: 60px;
            height: 60px;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            border-radius: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 24px;
            margin-bottom: 16px;
        }
        
        .mermaid {
            background: white;
            padding: 20px;
            border-radius: 12px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.05);
        }
        
        .drop-cap {
            float: left;
            font-size: 4em;
            line-height: 0.8;
            margin: 0.1em 0.1em 0 0;
            font-weight: 700;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            font-family: 'Noto Serif SC', serif;
        }
        
        .highlight-box {
            background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
            color: white;
            padding: 20px 30px;
            border-radius: 12px;
            margin: 20px 0;
            position: relative;
            overflow: hidden;
        }
        
        .highlight-box::before {
            content: '';
            position: absolute;
            top: -50%;
            right: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
            animation: pulse 3s ease-in-out infinite;
        }
        
        @keyframes pulse {
            0%, 100% { transform: scale(1); opacity: 0.5; }
            50% { transform: scale(1.1); opacity: 0.3; }
        }
        
        .practice-card {
            background: white;
            border-radius: 16px;
            padding: 24px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.05);
            border: 1px solid #e5e7eb;
            transition: all 0.3s ease;
        }
        
        .practice-card:hover {
            border-color: #667eea;
            box-shadow: 0 8px 30px rgba(102, 126, 234, 0.1);
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20">
        <div class="container mx-auto px-6">
            <div class="max-w-4xl mx-auto text-center">
                <h1 class="text-5xl md:text-6xl font-bold mb-6">
                    <i class="fas fa-th mr-4"></i>Java二维数组
                </h1>
                <p class="text-xl md:text-2xl opacity-90 leading-relaxed">
                    掌握矩阵思维，解锁数据结构新维度
                </p>
                <div class="mt-8 flex justify-center space-x-4">
                    <span class="bg-white bg-opacity-20 px-4 py-2 rounded-full text-sm">
                        <i class="fas fa-clock mr-2"></i>阅读时间：15分钟
                    </span>
                    <span class="bg-white bg-opacity-20 px-4 py-2 rounded-full text-sm">
                        <i class="fas fa-signal mr-2"></i>难度：中级
                    </span>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto px-6 py-12 max-w-6xl">
        
        <!-- 概述 Section -->
        <section class="mb-16">
            <div class="bg-white rounded-2xl shadow-lg p-8 md:p-12">
                <h2 class="section-title text-3xl font-bold mb-8 text-gray-800">概述</h2>
                <div class="prose prose-lg max-w-none">
                    <p class="text-gray-600 leading-relaxed mb-6">
                        <span class="drop-cap">二</span>维数组是一种特殊的数据结构，它由多个一维数组组成，每个一维数组又包含多个元素。可以将二维数组看作是一个表格或者矩阵，其中行和列分别对应数组的第一维和第二维。
                    </p>
                    
                    <div class="my-8">
                        <div class="mermaid">
                            graph LR
                                A[二维数组] --> B[第一行]
                                A --> C[第二行]
                                A --> D[第三行]
                                B --> B1[元素1,1]
                                B --> B2[元素1,2]
                                B --> B3[元素1,3]
                                C --> C1[元素2,1]
                                C --> C2[元素2,2]
                                C --> C3[元素2,3]
                                D --> D1[元素3,1]
                                D --> D2[元素3,2]
                                D --> D3[元素3,3]
                                
                                style A fill:#667eea,stroke:#764ba2,stroke-width:2px,color:#fff
                                style B fill:#f093fb,stroke:#f5576c,stroke-width:2px,color:#fff
                                style C fill:#f093fb,stroke:#f5576c,stroke-width:2px,color:#fff
                                style D fill:#f093fb,stroke:#f5576c,stroke-width:2px,color:#fff
                        </div>
                    </div>
                    
                    <p class="text-gray-600 leading-relaxed">
                        二维数组在Java中的声明和初始化方式类似于一维数组，但需要指定行数和列数。通过二维数组，我们可以更方便地表示和处理表格型数据，例如二维矩阵、游戏地图、图像像素等。
                    </p>
                </div>
            </div>
        </section>

        <!-- 定义和初始化 Section -->
        <section class="mb-16">
            <div class="bg-white rounded-2xl shadow-lg p-8 md:p-12">
                <h2 class="section-title text-3xl font-bold mb-8 text-gray-800">定义和初始化</h2>
                
                <div class="highlight-box mb-8">
                    <h3 class="text-xl font-bold mb-2">
                        <i class="fas fa-code mr-2"></i>基本语法
                    </h3>
                    <code class="block mt-4 bg-white bg-opacity-20 p-4 rounded-lg font-mono">
                        dataType[][] arrayName = new dataType[rows][columns];
                    </code>
                </div>
                
                <div class="grid md:grid-cols-2 gap-6 mt-8">
                    <div class="practice-card">
                        <div class="feature-icon">
                            <i class="fas fa-pencil-alt"></i>
                        </div>
                        <h3 class="text-xl font-bold mb-4 text-gray-800">直接赋值初始化</h3>
                        <p class="text-gray-600 mb-4">可以在声明时直接为数组赋值，适用于已知所有元素值的情况。</p>
                        <div class="code-block">
                            <pre><code>int[][] matrix = {
    {1, 2, 3},
    {4, 5, 6},
    {7, 8, 9}
};</code></pre>
                        </div>
                    </div>
                    
                    <div class="practice-card">
                        <div class="feature-icon">
                            <i class="fas fa-sync-alt"></i>
                        </div>
                        <h3 class="text-xl font-bold mb-4 text-gray-800">动态初始化</h3>
                        <p class="text-gray-600 mb-4">通过循环或其他逻辑来动态初始化数组，适用于需要计算生成元素值的情况。</p>
                        <div class="code-block">
                            <pre><code>int[][] matrix = new int[3][3];
for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
        matrix[i][j] = i + j;
    }
}</code></pre>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- 访问和操作 Section -->
        <section class="mb-16">
            <div class="bg-white rounded-2xl shadow-lg p-8 md:p-12">
                <h2 class="section-title text-3xl font-bold mb-8 text-gray-800">访问和操作</h2>
                
                <div class="grid md:grid-cols-3 gap-6">
                    <div class="card-hover bg-gradient-to-br from-purple-50 to-pink-50 p-6 rounded-xl">
                        <div class="text-3xl mb-4 text-purple-600">
                            <i class="fas fa-search"></i>
                        </div>
                        <h3 class="text-xl font-bold mb-3 text-gray-800">获取元素值</h3>
                        <p class="text-gray-600 mb-4">通过行列索引访问特定位置的元素</p>
                        <div class="code-block text-sm">
                            <pre><code>int value = matrix[1][2]; 
// 获取第二行第三列的元素</code></pre>
                        </div>
                    </div>
                    
                    <div class="card-hover bg-gradient-to-br from-blue-50 to-indigo-50 p-6 rounded-xl">
                        <div class="text-3xl mb-4 text-blue-600">
                            <i class="fas fa-edit"></i>
                        </div>
                        <h3 class="text-xl font-bold mb-3 text-gray-800">修改元素值</h3>
                        <p class="text-gray-600 mb-4">通过索引为特定位置赋新值</p>
                        <div class="code-block text-sm">
                            <pre><code>matrix[1][2] = 10; 
// 修改第二行第三列的值</code></pre>
                        </div>
                    </div>
                    
                    <div class="card-hover bg-gradient-to-br from-green-50 to-teal-50 p-6 rounded-xl">
                        <div class="text-3xl mb-4 text-green-600">
                            <i class="fas fa-list"></i>
                        </div>
                        <h3 class="text-xl font-bold mb-3 text-gray-800">遍历数组</h3>
                        <p class="text-gray-600 mb-4">使用嵌套循环访问所有元素</p>
                        <div class="code-block text-sm">
                            <pre><code>for (int i = 0; i < matrix.length; i++) {
    for (int j = 0; j < matrix[i].length; j++) {
        System.out.print(matrix[i][j]);
    }
}</code></pre>
                        </div>
                    </div>
                </div>
            </div>
        </section>

        <!-- 练习题 Section -->
        <section class="mb-16">
            <div class="bg-white rounded-2xl shadow-lg p-8 md:p-12">
                <h2 class="section-title text-3xl font-bold mb-8 text-gray-800">经典练习题</h2>
                
                <div class="space-y-8">
                    <div class="practice-